import {baseUrl, downloadFile, getRequest, postFormRequest, postRequest} from '../common/js/axios';

/***********************************************登陆(用户信息)*******************************************************************/
/** 登录操作 */
export const requestLogin = params => {
    return postFormRequest('/login', params);
}
/** 获取当前登录用户的基本信息 */
export const getCurrentUser = params=>{
    return getRequest("/user/getCurrent",params);
}
/**********************************************服务器管理**************************************************************/
/** 获取服务器列表 */
export const getServerListPage = params => {
    return getRequest('/server/listpage',params);
}
/** 移除服务器信息 */
export const removeServer = params => {
    return getRequest('/server/remove', params);
};
/** 批量移除服务器信息 */
export const batchRemoveServer = params => {
    return getRequest('/server/batchremove',params);
}
/** 编辑服务器信息 */
export const editServer = params => {
    return postRequest('/server/edit', params);
}
/** 添加服务其信息 */
export const addServer = params => {
    return postRequest('/server/add', params);
}
/** 导出服务器信息 */
export const exportExcelServer = params => { downloadFile('/server/export?searchKey='+params) };

/*************************************************相机管理*************************************************************/
/** 获取设备列表 */
export const getDeviceListPage = params => { return getRequest('/device/listpage', params ) };
/** 移除设备信息 */
export const removeDevice = params => { return getRequest('/device/remove', params) };
/** 批量移除 */
export const batchRemoveDevice = params => { return getRequest('/device/batchremove', params) };
/** 编辑设备 */
export const editDevice = params => { return postRequest('/device/edit', params) };
/** 添加设备 */
export const addDevice = params => { return postRequest('/device/add',params) };
/** 获取绑定用户信息 */
export const getBindUserList = params => { return getRequest('/device/listuser',params) };
/** 取消绑定 */
export const cancelBind = params => { return getRequest('/device/unbind',params) };
/** 导入设备信息 */
export const importExcelDeviceUrl =params=>{return baseUrl+"/device/import"  } ;
/** 导出设备信息 */
export const exportExcelDevice = params => { downloadFile('/device/export?searchKey='+params) };
/** 批量解除绑定*/
export const batchUnBindUser = params => { return getRequest('/device/batchUnBindUser', params) };

/*************************************************相机会话管理*********************************************************/
/** 获取会话列表 */
export const getSessionListPage = params => { return postRequest('/session/listpage',params) };
/** 删除会话信息 */
export const removeSession = params => { return getRequest('/session/remove', params) };
/** 批量删除会话信息 */
export const batchRemoveSession = params => { return getRequest('/session/batchremove', params) };
/** 导出会话信息 */
export const exportExcelSession = params => { downloadFile('/session/export?searchKey='+params) };

/*************************************************用户管理*************************************************************/
/** 获取用户列表 */
export const getUserListPage = params => { return getRequest('/user/listpage', params) };
/** 移除用户信息 */
export const removeUser = params => { return getRequest('/user/remove', params) };
/** 批量删除用户信息 */
export const batchRemoveUser = params => { return getRequest('/user/batchremove', params) };
/** 编辑用户信息 */
export const editUser = params => { return postRequest('/user/edit',params) };
/** 添加用户信息 */
export const addUser = params => { return postRequest('/user/add', params) };
export const updatePwd = params =>{ return getRequest('/user/updatePwd', params)  }
/** 短信发送 */
export const sendMsg = params => { return getRequest('/user/sendsmg', params) };
/** 获取用户的角色id */
export const getUserRole = params => { return getRequest('/user/getUserRole', params) };
export const editUserRole = params => { return postRequest('/user/editUserRole', params) };
/** 导出列表 */
export const exportExcelUser = params => { downloadFile('/user/export?searchKey='+params) };
/** 获取所有角色信息不分页 */
export const getRoleList = params => { return getRequest('/role/getAllList', params) };
/** 获取开发者账号信息 */
export const getDevUsers = params => { return getRequest('/user/getDevUsers', params) };
/** 获取当前用户未绑定的所有的设备信息*/
export const getDeviceList = params => { return getRequest('/device/list', params) };
/** 获取当前用户已绑定的所有的设备信息*/
export const getBindDeviceList = params => { return getRequest('/user/getBindDevices', params) };
/** 批量绑定设备*/
export const batchBindDevice = params => { return getRequest('/user/batchBindDevice', params) };
/** 批量解除绑定设备 */
export const batchUnBindDevice = params => { return getRequest('/user/batchUnBindDevice', params) };
/** 导入用户绑定信息 */
export const importExcelBindDeviceUrl =params=>{return baseUrl+"/user/bindImport"  } ;
/*************************************************短信记录管理*********************************************************/
export const getMsgListPage = params => { return postRequest('/msg/listpage', params); };

export const removeMsg = params => { return getRequest('/msg/remove', params); };

export const batchRemoveMsg = params => { return getRequest('/msg/batchremove', params); };


/*************************************************CMS-V版本管理********************************************************/


/*************************************************系统日志管理*********************************************************/
/** 获取日志列表 */
export const getSysLogListPage = params => {
    return postRequest('/sysLog/listpage', params);
};
/** 删除日志 */
export const removeSysLog = params => {
    return getRequest('/sysLog/remove', params);
};
/** 批量删除 */
export const batchRemoveSysLog = params => {
    return getRequest('/sysLog/batchremove', params);
};
/** 导出excel */
export const exportExcelSysLog = params => {
    downloadFile('/sysLog/export?searchKey='+params);
};

/************************************************* 角色管理 *********************************************************/
/** 获取角色列表信息 */
export const getRoleListPage = params => {
    return getRequest('/role/listpage', params)
};
/** 获取所有的权限信息 */
export const getAllPermission = params =>{
    return getRequest('/permission/getAllList', params)
};
/** 获取当前角色包含的权限的Id列表 */
export const getPermissionIdWithRole = params =>{
    return getRequest('/sysLog/listpage', params)
};
/** 添加角色 */
export const addRole = params =>{
    return postRequest('/role/add', params)
};
/** 编辑角色 */
export const editRole = params =>{
    return postRequest('/role/edit', params)
};
/** 删除角色 */
export const removeRole = params =>{
    return getRequest('/role/remove', params)
};
/** 删除角色 */
export const batchRemoveRole = params =>{
    return getRequest('/role/batchRemove', params)
};
/** 删除角色 */
export const getChildrenByRoleId = params =>{
    return getRequest('/role/getChildrenByRoleId', params)
};

/************************************************* 权限管理 *********************************************************/
/** 添加权限信息 */
export const addPermission = params=>{
    return postRequest('/permission/add',params);
};
/** 编辑权限信息 */
export const editPermission = params=>{
    return postRequest('/permission/edit',params);
};
/** 删除权限信息 */
export const deletePermission = params=>{
    return getRequest('/permission/delByIds',params);
};
/** 搜索权限信息 */
export const searchPermission = params=>{
    return getRequest();
};

/** 获取父节点的权限信息 */
export const getParentPermission = params=>{
    return getRequest('/permission/getParent',params);
};

/** 获取单个权限信息 */
export const getPermissionById = params=>{
    return getRequest('/permission/get',params);
};
export const getMenuList = params=>{
    return getRequest('/permission/getMenuList',params);
};



